package com.wkt.excel;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;

import java.util.Map;

/**
 * @author wangkt
 * @Describe
 * @date 2022/7/3 19:38
 */
public class ExcelListener extends AnalysisEventListener<User> {

    /**
     * 一行一行的读取excel中的内容，并封装到User中
     * 默认从excel第二行开始读
     * @param user
     * @param analysisContext
     */
    @Override
    public void invoke(User user, AnalysisContext analysisContext) {
        System.out.println(user);
    }

    /**
     * 读取表头的方法
     * @param headMap
     * @param context
     */
    @Override
    public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
        System.out.println("表头:"+headMap);
    }


    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {

    }
}
